<div class="filemgr_head keywords_head">
    <ul class="filemgr_menu">
        <li class="marginleft20 filesearch">
            <form onsubmit="javascript:return false;">
                <input type="text" value="输入关键词并回车" class="filekeyword" id="filekeyword">
            </form>
        </li>
        <li class="marginleft5 viewfilebtn"><a href="javascrip:void(0);" id="modify_prices" class="xbtn preview preview_disabled">批量改价</a></li>

    </ul>
    <span class="clearall"></span>
    <br class="clear" />
  <div class="widgetoptions" id="recommend_types">
    <a href="javascript:void(0)" class="stdbtn">推荐关键词</a>
    <a href="javascript:void(0)" class="stdbtn">相关关键词</a>
    <a href="javascript:void(0)" class="stdbtn">组合关键词</a>
    <a href="javascript:void(0)" class="stdbtn">关键词过滤器</a>
    </div>
     <br class="clear" />
        <table cellspacing="0" cellpadding="0" border="0" class="stdtable">
        <colgroup>
            <col class="con0">
            <col class="con1">
            <col class="con0">
            <col class="con1">
        </colgroup>
        <thead>
            <tr>
                <th class="head0">关键词</th>
                <th class="head1">搜索量</th>
                <th class="head0">相关度</th>
                <th class="head0">平均出价</th>
            </tr>
        </thead>
        <tbody id="recommend_keywords">
        
        </tbody>
    </table>     
    

</div>
<div class="filemgr_category">

<table cellpadding="0" cellspacing="0" border="0" class="stdtable noborder" id="dyntable">
<colgroup>
    <col class="con0" />
    <col class="con1" />
    <col class="con0" />
    <col class="con1" />
    <col class="con0" />
</colgroup>
<thead>
    <tr>
        <th class="head0 nolborder"><div class="checker" ><span><input id="checkall" type="checkbox" class="checkall" style="opacity: 0;"></span></div></th>
        <th class="head1">关键词</th>
        <th class="head1">展现量</th>
        <th class="head0">点击量</th>
        <th class="head1">点击率</th>
        <th class="head0">CPC</th>
        <th class="head0">当前出价</th>
        <th class="head1">智能出价</th>
        <th class="head0">锁定排名</th>
        <th class="head1 norborder">操作</th>
    </tr>
</thead>

<tbody id="keywords_tbody">
    <volist name="keywords" id="v">
    <tr class="gradeX">
        <td class="center nolborder"><div class="checker"><span><input value="{$v.keyword_id}"  name="keyword_id" type="checkbox" style="opacity: 0;"></span></div></td>
        <td class="center">{$v.word} </td>
        <td class="center">{$v.pv}</td>
        <td class="center">{$v.click}</td>
        <td class="center">{$v.click_rate}%</td>
        <td  class="center">{$v.cpc}</td>
        <td class="center">
        {$v.max_price}
        </td>
        <td class="center">
            <p class="field switch">
                <label class="cb-enable"><span>打开</span></label>
                <label class="cb-disable selected"><span>关闭</span></label>
                <input type="checkbox" id="checkbox" class="checkbox" name="field2" />
            </p>   
        </td>
        <td class="center">
           <select class="" name="select">
                <option value="">不锁定排名</option>
                <option value="">锁定第一页右边第二排位</option>
                <option value="">锁定第二页</option>
                <option value="">锁定第三页</option>
                <option value="">锁定第四页</option>
            </select>
        </td>
        <td class="center norborder">
        <a class="btn btn3 btn_trash" href="javascript:void(0);"></a>
        </td>
    </tr>
    </volist>

</tbody>
</table>      

<script type="text/javascript">    
    (function($) {

        AdgroupKeywordsManage = function(options_){
            var options = {};
            
            var tabs = [];
            
            var input_keyword = [];
            
            var params = {};
                        
            function init(opts){                
                $("#filekeyword").keypress(function (e) { 
                    var key = e.which; 
                    if (key == 13) {
                        updateKeywords( $(this).val() );
                    }
                    
                });
                
                $("#recommend_types a").each(function(e){
                    $(this).bind("click" , getRecommendKeywords);
                });
                
            }
            
            function updateKeywords(word){
                if( input_keyword.indexOf(word) > 0 ){
                    wt.showNotice("关键词已经添加了");
                    return;
                } 
                var url = '/keyword/add';
                input_keyword.push( word );
                wt.get(url , { keyword : word } , function(r){
                    var row = $(r);
                    row.fadeIn(2000);
                    $("#keywords_tbody").prepend(row);
                    getRecommendKeywords();
                }); 
            
            }
            
            function getRecommendKeywords(){
                var url = "/keyword/recommend";
                
                wt.get(url , '', function(r){
                    $("#recommend_keywords").html('<tr><td colspan="4"><img src="load3.gif" /></td></tr>');
                    var rows = $(r);
                    rows.find(".add_recommend").bind("click" , function(){
                         updateKeywords( $(this).html() );
                    });
                    rows.fadeIn(500);
                    $("#recommend_keywords").html(rows);
                });
            
            }
            
            
            
            
            init(options_);
        }
        
        $.iadgroup = function(options_) {
            //var t0 = new Date();
            var adgroupmanage = new AdgroupKeywordsManage(options_);
            return adgroupmanage;
        };
    })(jQuery);
    
    jQuery(function () {
        var myadgroup = $.iadgroup();
        //$('input:radio').checkbox();
        
        $(".cb-enable").click(function(){
            var parent = $(this).parents('.switch');
            $('.cb-disable',parent).removeClass('selected');
            $(this).addClass('selected');
            $('.checkbox',parent).attr('checked', true);
        });
        $(".cb-disable").click(function(){
            var parent = $(this).parents('.switch');
            $('.cb-enable',parent).removeClass('selected');
            $(this).addClass('selected');
            $('.checkbox',parent).attr('checked', false);
        });
        
        $("select").uniform();
        
    });
</script>       
